In [2]:
import graphlab
In [3]:
sf = graphlab.SFrame('')
In [1]:
sf = graphlab.SFrame('people-example.csv')
In [2]:
import graphlab
In [3]:
sf = graphlab.SFrame('people-example.csv')
In [4]:
sf # we can view first few lines of the table
Out[4]:
In [5]:
sf.head()
Out[5]:
In [6]:
sf.tail()
Out[6]:
In [7]:
sf.show()
In [8]:
graphlab.canvas.set_target('ipynb')
In [9]:
sf['age'].show(view='Categorical')
In [10]:
sf['Country']
Out[10]:
In [11]:
sf['age'].mean()
Out[11]:
In [12]:
sf
Out[12]:
In [13]:
sf['Full Name'] = sf['First Name'] + ' ' + sf['Last Name']
In [14]:
sf
Out[14]:
In [15]:
sf['Country']
Out[15]:
In [16]:
sf['Country'].show()
In [18]:
def transform_country(country):
return 'United States' if country == 'USA' else country
In [20]:
transform_country('USA')
Out[20]:
In [21]:
transform_country('India')
Out[21]:
In [24]:
sf['Country'] = sf['Country'].apply(transform_country)
In [23]:
sf
Out[23]:
In [25]:
sf
Out[25]:
In [26]:
sf['Country'].show()
In [ ]: